<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>01-canvas</title>
    <style>
        canvas{
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="800" height="600"></canvas>
    <script>
        var canvas = document.getElementById("canvas")
        var ctx = canvas.getContext("2d")
        console.log(ctx)
        ctx.moveTo(200,200)
        ctx.lineTo(300,200)
        ctx.lineTo(300,300)
        ctx.lineTo(200,300)
        ctx.lineTo(200,200)
        ctx.fill()
        ctx.moveTo(250,300)
        ctx.lineTo(250,320)
        ctx.moveTo(220,320)
        ctx.lineTo(280,320)
        ctx.lineTo(280,320)
        ctx.stroke()
        ctx.beginPath()
        ctx.moveTo(400,200)
        ctx.lineTo(600,200)
        ctx.lineTo(430,330)
        ctx.lineTo(500,130)
//        ctx.fill()
        ctx.lineTo(570,330)
        ctx.lineTo(400,200)
//        ctx.stroke()
        ctx.fill("evenodd")
        ctx.strokeStyle = "#f0f"
//        ctx.fillStyle = "#f0f";
//        ctx.lineWidth = "10px"
    </script>
</body>
</html>